package cn.hanyx.coder.design.pattern.behavioral.visitor.demo06.compressor;

import cn.hanyx.coder.design.pattern.behavioral.visitor.demo06.ResourceFileType;

import java.util.HashMap;
import java.util.Map;

/**
 * CompressorFactory
 *
 * @author hanyx
 * @date 2020/07/29
 */
public class CompressorFactory {

    private static final Map<ResourceFileType, Compressor> compressors = new HashMap<>();

    static {
        compressors.put(ResourceFileType.PDF, new PdfCompressor());
        compressors.put(ResourceFileType.PPT, new PPTCompressor());
        compressors.put(ResourceFileType.WORD, new WordCompressor());
    }

    public static Compressor getCompressor(ResourceFileType type) {
        return compressors.get(type);
    }
}
